<template>
  <el-container class="index-con">
    <el-aside :class="showclass">
      <div class="logobox">
        <img class="logoimg" src="../assets/img/logo.png" alt="" />
      </div>
      <el-menu
        router
        background-color="#545c64"
        :default-active="$route.path"
        style="height:530px"
        text-color="#fff"
        active-text-color="#ffd04b"
      >
        <NavMenu :navMenus="leftMenus" />
      </el-menu>
    </el-aside>

    <el-container class="main-con">
      <el-header class="index-header">
        <navcon></navcon>
      </el-header>
      <el-main clss="index-main" style="height:550px">
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>
<script>
// 导入组件
import navcon from "../components/navcon.vue";
import NavMenu from "../components/leftnav.vue";
import { mapState } from "vuex";
export default {
  name: "index",
  data() {
    return {
      showclass: "asideshow",
      showtype: false,
      leftMenus: []
    };
  },
  // 注册组件
  components: {
    navcon,
    NavMenu
  },
  methods: {},
  //   created() {
  //     // 监听
  //     this.$root.Bus.$on("toggle", value => {
  //       if (value) {
  //         this.showclass = "asideshow";
  //       } else {
  //         setTimeout(() => {
  //           this.showclass = "aside";
  //         }, 300);
  //       }
  //     });
  //   },
  computed: {
    ...mapState(["rightList"])
  },
  created() {
    this.leftMenus = this.rightList;
    console.log(this.leftMenus);
  },
  beforeUpdate() {},
  // 挂载前状态(里面是操作)
  beforeMount() {
    // 弹出登录成功
    this.$message({
      message: "登录成功",
      type: "success"
    });
  }
};
</script>
<style>
.index-con {
  height: 100%;
  width: 100%;
  box-sizing: border-box;
}

.aside {
  width: 64px !important;
  height: 100%;
  background-color: #334157;
  margin: 0px;
}
.asideshow {
  width: 240px !important;
  height: 593px;
  background-color: #334157;
  margin: 0px;
}
.index-header,
.index-main {
  padding: 0px;
  border-left: 2px solid #333;
}
.logobox {
  height: 40px;
  line-height: 40px;
  color: #9d9d9d;
  font-size: 20px;
  text-align: center;
  padding: 20px 0px;
}
.logoimg {
  height: 40px;
}
</style>
